package com.ocm.core.model;

import java.util.Map;

import com.ocm.core.domain.ClassDefinition;
import com.ocm.core.domain.PropertyDefinition;

public class ClassInstance {

   private ClassDefinition classDefinition;

   private Map<PropertyDefinition, Object> properties;

   private String realPath;

   private String nodeName;

   private String nodeUUID;

   private String jcrNodeSecurityObj;

   private boolean hasSyncSecurity; 

   public ClassDefinition getClassDefinition() {
      return classDefinition;
   }

   public void setClassDefinition(ClassDefinition classDefinition) {
      this.classDefinition = classDefinition;
   }

   public Map<PropertyDefinition, Object> getProperties() {
      return properties;
   }

   public void setProperties(Map<PropertyDefinition, Object> properties) {
      this.properties = properties;
   }

   public String getRealPath() {
      return realPath;
   }

   public void setRealPath(String realPath) {
      this.realPath = realPath;
   }

   public String getNodeName() {
      return nodeName;
   }

   public void setNodeName(String nodeName) {
      this.nodeName = nodeName;
   }

   public String getNodeUUID() {
      return nodeUUID;
   }

   public void setNodeUUID(String nodeUUID) {
      this.nodeUUID = nodeUUID;
   }

   public String getJcrNodeSecurityObj() {
      return jcrNodeSecurityObj;
   }

   public boolean isHasSyncSecurity() {
      this.hasSyncSecurity = false;
      String security = null;
      if (classDefinition.getSecurity() != null)
         security = classDefinition.getSecurity().getSecurityInformation();

      if (security != null && jcrNodeSecurityObj != null)
         this.hasSyncSecurity = security.equals(jcrNodeSecurityObj);

      if (security == null && jcrNodeSecurityObj == null)
         this.hasSyncSecurity = true;
      return this.hasSyncSecurity;
   }

   public void setJcrNodeSecurityObj(String jcrNodeSecurityObj) {
      this.jcrNodeSecurityObj = jcrNodeSecurityObj;
      
   }
}
